from werkzeug.exceptions import HTTPException


def error_handler(app):
    @app.errorhandler(HTTPException)
    def handle_error(error):
        print("error:", error.name)
        response = {
            'code': 500,
            'message': str(error),
            'data': None
        }
        return response, 500
